from django.conf.urls import url

from . import views

urlpatterns = [

    # 演示反向解析
    url(r'^reverse_demo/$', views.reverse_demo),

    url(r'^response_demo/$', views.response_demo),

    url(r'^jsonResponse_demo/$', views.jsonResponse_demo, name='index'),

    #参数需要加括号
    # url(r'^weather/[a-z]+/\d{4}/$', views.weather1),

    # url(r'^weather/([a-z]+)/(\d{4})/$', views.weather2),

    # 演示利用正则组起别名提取url路径参数(关键字参数)
    url(r'^weather/(?P<city>[a-z]+)/(?P<year>\d{4})/$', views.weather2),

    url(r'^get_query_param/$', views.get_query_param),

    url(r'^get_body_form/$', views.get_body_form),

    #获取请求json数据
    url(r'^get_body_json/$', views.get_body_json),

    #获取设置cookie
    url(r'^cookie_demo/$', views.cookie_demo),

    #获取设置session
    url(r'^session_demo/$',views.session_demo),

]